home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
boe.pres.k12.wv.us
/
boe.pres.k12.wv.us.zip
/
boe.pres.k12.wv.us
/
Utilities
/
Xerox Workcentre 5335
/
Windows Scan
/
32-bit_x86
/
Francais
/
cpsimage.cab
/
data
/
docio
/
tifffxFmtAdj.elf
< prev
next >
Wrap
Text File
|
2009-03-16
|
2KB
|
64 lines
/*
** This script is used as part of the document library.
** Images processed for TIFF-FX have to conform to fixed parameters.
** This script takes an input XIPIMAGE and correct parameters to
** fix the image.
*/
IMPORT XIPIMAGE inImg, outImg;
IMPORT INTEGER dw, dh;
IMPORT STRING outfile;
IMPORT INTEGER outphoto;
// SetStatus (op: "debug");
#load "xipProcs/printImageLayers.proc";
LoadClasses ( filename: "xeng" );
INTEGER photo = inImg.getMember (num: 0, member: "photometry");
INTEGER bits = inImg.getMember (num: 0, member: "bits");
INTEGER comp = inImg.getMember (num: 0, member: "compression");
INTEGER pix = inImg.getMember (num: 0, member: "pixels");
INTEGER sln = inImg.getMember (num: 0, member: "scanlines");
// debug info
// print PrintImageLayers (img: inImg);
// print dw,dh, Photo2Str(photo: photo), Photo2Str(photo: outphoto), CompType (comp: comp), outfile;
inImg = inImg.unCompress();
// Width correction
if ( dw < pix )
inImg = inImg.scale ( awindow: (dw,sln) );
else if ( dw > pix )
inImg = inImg.pad ( bytes: (dw+7)/8, pixel:TRUE );
// Height correction
if ( dh < sln )
inImg = inImg.scale ( awindow: (pix,dh) );
else if ( dh > sln )
inImg = inImg.frame ( thick: (0,0,0,dh-sln), value: (255), outside: TRUE );
// Correct photometry
if ( outphoto == XIP_ITULAB_COLOR )
inImg = inImg.cspace ( outspace: "itulab");
// Get back to original bits and compression
STRING cstr = CompressionStr (comp: comp);
if ( cstr.strcasecmp (str: "jp") ) cstr = "jpeg";
else if ( cstr.strcasecmp (str: "jb") ) cstr = "jbig2";
inImg = inImg.convert ( to: (bits)
).compress (type: cstr
).exec(
);
inImg.imageWidth = inImg.getMember (num: 0, member: "pixels");
inImg.imageHeight = inImg.getMember (num: 0, member: "scanlines");
inImg.setMember ( member: "width", value: inImg.imageWidth );
inImg.setMember ( member: "height", value: inImg.imageHeight );
// print PrintImageLayers (img: inImg), "\n";
outImg = inImg;